<template>
  <div class="detection">
    <div class="header">
      <span class="hd">智能检测</span>
      <span class="div_">/</span>
      <span class="hd2">人工智能辅助心音检测</span>
    </div>
    <div class="header2">
      <div class="step_">
        <el-steps :active="active" finish-status="">
          <el-step v-for="(item, index) in steps" :status="step_status[index]"></el-step>
        </el-steps>
      </div>
    </div>
    <transition name="el-fade-in-linear">
<!--      <keep-alive>-->
        <router-view></router-view>
<!--      </keep-alive>-->
    </transition>
  </div>
</template>

<script>
export default {
  name: "Detection",
  data() {
    return {
      active: 0,
      step_status: ["wait", "wait", "wait"],
      steps: [0, 1, 2]
    };
  },
  watch: {
    $route() {
      // console.log(to.name," ",from.name);
      const cur_path = this.$route.name;
      window.localStorage.setItem("cur_activity", cur_path);
      if(cur_path == "Helper" || cur_path == "Helper0") {
        this.active = 0;
        this.step_status = ["process", "wait", "wait"];
        console.log(cur_path);
      }
      else if(cur_path == "Upload") {
        this.active = 1;
        this.step_status = ["success", "process", "wait"];
      }
      else if(cur_path == "Report") {
        this.active = 2;
        this.step_status = ["success", "success", "process"];
      }

      window.localStorage.setItem("cur_active", this.active);
      window.localStorage.setItem("cur_step_status", JSON.stringify(this.step_status));
    }
  },
  mounted() {
    this.active = parseInt(window.localStorage.getItem("cur_active"));
    this.step_status = JSON.parse(window.localStorage.getItem("cur_step_status"));
  }
}
</script>

<style scoped>
  * {
    margin: 0;
    padding: 0;
  }
 .detection {
   width: 100%;
   height: 100%;
   /*background-color: rgba(250, 231, 230, 0.24);*/
 }
 .header, .header2 {
   width: 98%;
   height: 60px;
   line-height: 100%;
   background-color: white;
   margin: 0 auto;
   box-shadow: 0 0 10px rgb(82 63 105 / 8%);
   border-radius: 8px;
   text-align: left;
 }
 .header2 {
   margin-top: 20px;
   height: 80px;
   overflow: hidden;
 }
 .hd, .hd2 {
   display: inline-block;
   width: 80px;
   height: 60px;
   line-height: 60px;
   margin-left: 30px;
   font-weight: 600;
   color: #627EEA;
   letter-spacing: 1px;
   overflow: hidden;
 }
 .div_ {
   overflow: hidden;
   display: inline-block;
   padding: 0;
   font-size: 30px;
   height: 60px;
   line-height: 60px;
   color: #627EEA;
   font-weight: 300;
   /*margin-top: 5px;*/
 }
 .hd2 {
   margin-left: 10px;
   width: 180px;
   color: #828690;
   font-weight: 500;
 }
 .step_ {
   width: 86%;
   height: 80px;
   color: #1362FC;
   line-height: 80px;
   margin: 0 auto;
 }
 /*开始前*/
  .step_ >>> .el-step__line {
    background-color: #EEEEEE;
    border-color: #EEEEEE;
    position: absolute;
    margin-top: 30px;
    width: 91%;
    margin-left: 9%;
  }
  .step_ >>> .el-step__icon.is-wait {
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1.5px solid #1362FC;
    color: #1362FC;
    font-size: 14px;
    font-weight: 200;
    font-family: "ui-sans-serif";
  }
  /*进行中*/
  .step_ >>> .el-step__head.is-process > .el-step__icon {
    width: 40px;
    height: 40px;
    background-color: rgba(19, 98, 252, 1);
    border: 1.5px solid rgba(19, 98, 252, 1);
    color: white;
    font-size: 14px;
    font-weight: 200;
    font-family: "ui-sans-serif";
  }
  .step_ >>> .el-step__head.is-process > .el-step__line {
    background-color: rgba(19, 98, 252, 0.56);
  }
  /*等待时*/
  .step_ >>> .el-step__head.is-wait > .el-step__icon {
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1.5px solid #1362FC;
    color: #1362FC;
    font-size: 14px;
    font-weight: 200;
    font-family: "ui-sans-serif";
  }
  /*完成后*/
  .step_ >>> .el-step__head.is-finish > .el-step__line {
    background-color: rgba(19, 98, 252, 1);
    border-color: #1362FC;
  }
  .step_ >>> .el-step__head.is-finish > .el-step__icon {
    width: 40px;
    height: 40px;
    background-color: #1362FC;
    border: 1.5px solid #1362FC;
    color: white;
    font-size: 14px;
    font-weight: 200;
    font-family: "ui-sans-serif";
  }
  /*成功*/
  .step_ >>> .el-step__head.is-success > .el-step__line {
    background-color: rgba(19, 98, 252, 1);
    border-color: #1362FC;
  }
  .step_ >>> .el-step__head.is-success > .el-step__icon {
    width: 40px;
    height: 40px;
    background-color: #1362FC;
    border: 1.5px solid #1362FC;
    color: white;
    font-size: 14px;
    font-weight: 200;
    font-family: "ui-sans-serif";
  }
</style>
